﻿function callScriptMethod(url, parameters, callback, async) {

   callback = callback || function () { };
   async = (async == null || async);

   $.ajax({
      type: "POST",
      contentType: "application/json; charset=utf-8",
      url: url,
      data: JSON.stringify(parameters),
      dataType: "json",
      async: async,
      success: function (result) {
         if ('d' in result)
            callback(result.d);
         else
            callback(result);
      },
      error: function () {
         alert("Error calling '" + url + "' " + JSON.stringify(parameters));
         callback([]);
      }
   });

}
